﻿using System;

namespace 抽象类
{
    public abstract class Shape
    {
        public abstract double GetArea();

        public abstract double GetPerimeter();
    }

    public class Circular : Shape
    {
        public Circular(double r)
        {
            R = r;
        }

        private double _r;
        public double R { get => _r; set => _r = value; }

        public override double GetArea()
        {
            return R * R * Math.PI;
        }

        public override double GetPerimeter()
        {
            return 2 * R * Math.PI;
        }
    }

    public class Square : Shape
    {
        public Square(double h, double wide)
        {
            Long = h;
            Wide = wide;
        }

        private double _long;
        private double _wide;

        public double Long { get => _long; set => _long = value; }
        public double Wide { get => _wide; set => _wide = value; }

        public override double GetArea()
        {
            return Long * Wide;
        }

        public override double GetPerimeter()
        {
            return 2 * (Long + Wide);
        }
    }
}